<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>


<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
        <span aria-hidden="true">&times;</span></button>
    <h4 class="modal-title">经费录入</h4>
</div>
<div class="modal-body">
    <form id="form_data">
        <div class="table-responsive">
            <table class="table table-hover table-striped table-bordered">
                <tr>
                    <th>姓名</th>
                    <th>身份证号</th>
                    <th>开户行</th>
                    <th>银行卡号</th>
                    <th>成员类型</th>
                    <th>专家类型</th>
                    <th>证书编号</th>
                    <th style="width: 110px">天数（天）</th>
                    <th style="width: 110px">日薪资（元）</th>

                </tr>

                <input type="hidden" name="businessId" value="${businessId}">

                <c:forEach items="${inspectorInfoList}" varStatus="status" var="i">
                    <tr>
                        <td>${i.expertName}</td>
                        <td>${i.expertIdCard}</td>
                        <td>${i.bankName}</td>
                        <td>${i.bankCard}</td>
                        <td>
                            <c:choose>
                                <c:when test="${i.expertRole=='leader'}">组长</c:when>
                                <c:otherwise>组员</c:otherwise>
                            </c:choose>
                        </td>
                        <td>${i.certificateGrade}</td>
                        <td>${i.certificateNum}</td>
                        <input type="hidden" name="inspectorFundList[${status.index}].inspectorId" value="${i.id}">
                        <td>
                            <div class="form-group">
                                <div>
                                    <input type="text" class="form-control "
                                           name="inspectorFundList[${status.index}].workDay" value="1">
                                </div>
                            </div>
                        </td>
                        <td>
                            <div class="form-group">
                                <div>
                                    <select class="form-control" name="inspectorFundList[${status.index}].dailySalary">
                                        <option value="">&nbsp;</option>
                                        <c:forEach items="${fundSetList}" var="jj">
                                            <option value="${jj.dayMoney}">${jj.dayMoney}</option>
                                        </c:forEach>
                                    </select>
                                </div>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td colspan="9" style="text-align: center">
                        <button type="submit"
                                class="btn btn-default btn-success"><span
                                class="glyphicon glyphicon-ok"></span>&nbsp;确&nbsp;定&nbsp;
                        </button>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>



<script>
    $.sysPlugin.initSimpleSelect2();


    var $form_data = $("#form_data");
    $form_data.bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            <c:forEach items="${inspectorInfoList}" varStatus="status" var="i" >
            'inspectorFundList[${status.index}].workDay': {
                validators: {
                    notEmpty: {
                        message: '不能为空！'
                    },
                    greaterThan: {
                        value: 0,
                        message: '非法字符！'
                    }
                }
            },
            'inspectorFundList[${status.index}].dailySalary': {
                validators: {
                    notEmpty: {
                        message: '不能为空！'
                    }
                }
            },
            </c:forEach>
        }
    }).on('success.form.bv', function (e) {
        e.preventDefault();
        $.sysPlugin.superAjax({
            data: $form_data.serializeObject(),
            url: '${url}',
            operateType: '${operateType}',
            showSuccessAlert: true,
            showWarnAlert: true,
            successCall: function (data) {
                $.sysPlugin.successCallBack(data, {
                    modal: $("#modal_ajax"),
                    table: $("#table_data")
                })
            },
            errorCall: function (data) {
                $.sysPlugin.errorCallBack(data, {
                    form: $form_data
                })
            }, warnAlertCancelCall: function () {
                $form_data.data('bootstrapValidator').resetForm();
            }

        })
    });

</script>


